<% if mobile? %>
  <% content_for :app_back do %>

  <a href="javascript:void(0)" onclick="history.go(-1)">
    <i class="icon-arrow-left"></i>
  </a>
  <% end %>

  <% content_for :app_title do %>
    门窗百科
  <% end %>

  <% content_for :app_action do %>
  <a href="#"></a>
  <% end %>

  <hr class="de-line">
  <div class="mobile-wiki-index">
    <% @wikis.each do |wiki| %>
      <a href="<%= wiki_path wiki %>" class="item">
        <div class="item-img" style="background-image: url(<%= wiki_small_img_url(wiki) %>);"></div>
        <h1><%= wiki.title %></h1>
        <p>
          <%= truncate(strip_tags(wiki.content), length: 40).gsub(/\A[[:blank:]]+/,'') %>
        </p>
      </a>
    <% end %>
    <% if @wikis.total_pages > 1 %>
      <div class="wiki-index-pagination" style="text-align:center;">
        <%= render partial: 'shared/common_pagination', locals: { pagination: @wikis } %>
      </div>
    <% end %>
  </div>
<% else %>
  <%# 头部 %>
  <div class="container layout-container new-wiki-index">
    <div class="top">
      <div class="pull-right">
        <%= link_to combine_query_params(type: nil), class: params[:type] ? '' : 'active' do %>
          <i class="glyphicon glyphicon-align-justify"></i>
        <% end %>
        <%= link_to combine_query_params(type: 'block'), class: params[:type] ? 'active' : '' do %>
          <i class="glyphicon glyphicon-th"></i>
        <% end %>
      </div>
      <ul>
        <% @wiki_categories.each do |cate| %>
          <li class="<%= 'active' if cate.id.to_s == params[:wiki_category_id] %>">
            <%= link_to cate.title, combine_query_params({wiki_category_id: cate.id}) %>
          </li>
        <% end %>
      </ul>
    </div>


      <div class="row list <%= params[:type] ? 'block' : 'line'%>">
        <% @wikis.each do |wiki| %>
          <div class="col-xs-<%= params[:type] ? '4' : '12'%> item">
            <div herf="<%= wiki_path wiki %>" class="img" style="background-image: url(<%= wiki_small_img_url wiki %>)"></div>
            <div class="info">
              <h1><a href="<%= wiki_path wiki %>" class=""><%= link_to wiki.title, wiki_path(wiki) %></a></h1>
              <% unless params[:type] %>
                <span class="time"><%= wiki.publish_time.to_s(:db) %></span>
                <br>
              <% end %>
              <span class="summary"><%= truncate(strip_tags(wiki.content), length: 40).gsub(/A[[:blank:]]+/, '') %></span>
            </div>
          </div>
        <% end %>
      </div>


    <% if @wikis.total_pages > 1 %>
      <div class="wiki-index-pagination">
        <%= common_paginate @wikis %>
      </div>
    <% end %>
  </div>
<% end %>
